#ifndef NOTIFICATIONDISPLAYER_H
#define NOTIFICATIONDISPLAYER_H

#include <QPointer>
#include <QThread>
#include <QTimer>

class Notification;


class NotificationDisplayer : public QThread
{
    Q_OBJECT
public:
    explicit NotificationDisplayer (Notification* notification, int position, QObject* parent = 0);

public slots:
    void movingStarted();
    void movingEnded();
    void proceed();
    void quitRequest();

protected:
    void run();

private:
    void beginFadingIn();
    void beginWaiting();
    void checkPosition();

    Notification* notification;
    int position;
    int showTime;
    int elapsed;

    QPointer<QTimer> fadeInTimer;
    QPointer<QTimer> waitTimer;
    QPointer<QTimer> fadeOutTimer;

private slots:
    void fadeIn();
    void checkElapsed();
    void beginFadingOut();
    void fadeOut();

signals:
    void setOpacity (qreal);
    void fadingOutStarted (int);
    void close();
};


#endif // NOTIFICATIONDISPLAYER_H
